from aiohttp import web
from Init import init
from middleware.MiddleWare import error_middleware
async def on_startup(app):
    # await initDB(app)
    pass


async def on_stop(app):
    # pool = app['db']
    # if not pool:
    #     pool.close()
    #     await pool.wait_closed()
    pass
def main():
    app = web.Application(middlewares=[error_middleware])
    init(app)
    app.on_startup.append(on_startup)
    app.on_cleanup.append(on_stop)
    web.run_app(app, host='0.0.0.0', port=8000)

app = web.Application(middlewares=[error_middleware])
init(app)
app.on_startup.append(on_startup)
app.on_cleanup.append(on_stop)






if __name__ == '__main__':
    main()
